package com.example.logistics_oa.controller;


import com.example.comment_oa.pojos.xinzi.*;
import com.example.comment_oa.pojos_vo.salaryVo.SalaryZhuBiaoVo;
import com.example.comment_oa.response.AjaxResponse;
import com.example.logistics_oa.service.JibenButiejisuanService;
import com.example.logistics_oa.service.JibenKaoqinhesuanService;
import com.example.logistics_oa.service.JibenWuxianyijinService;
import com.example.logistics_oa.service.ShsalaryZhubiaoService;
import org.apache.commons.collections4.Get;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/logisticsOa")
@CrossOrigin
public class SalaryZhuBiaoController {

    @Autowired
    ShsalaryZhubiaoService shsalaryZhubiaoService;
    @Autowired
    JibenKaoqinhesuanService jibenKaoqinhesuanService;
    @Autowired
    JibenButiejisuanService jibenButiejisuanService;
    @Autowired
    JibenWuxianyijinService jibenWuxianyijinService;

    @PostMapping("/selectall")
    public AjaxResponse selectall(@RequestBody SalaryZhuBiaoVo salaryZhuBiaoVo){
//        System.err.println(salaryZhuBiaoVo);
        List<ShsalaryZhubiao> selectall = shsalaryZhubiaoService.selectall(salaryZhuBiaoVo);
//        System.err.println(selectall);
        return AjaxResponse.success(selectall);
    }
    @PostMapping("/selectById/{srId}")
    public AjaxResponse selectById(@PathVariable("srId")String srId ){
        List<ShsalaryZhubiao> shsalaryZhubiaos = shsalaryZhubiaoService.selectId(srId);
        return AjaxResponse.success(shsalaryZhubiaos);
    }

    @PostMapping("/selectBuTieById/{srId}")
    public AjaxResponse selectBuTieById(@PathVariable("srId")String srId ){
        List<JibenButiejisuan> jibenButiejisuans = jibenButiejisuanService.selectAllMoneyByButieid(srId);
//        System.err.println(jibenButiejisuans+"???");



        return AjaxResponse.success(jibenButiejisuans);
    }

    @PostMapping("/selectOneBuTie/{jibenId}/{zhiwuId}/{gonghao}")
    public AjaxResponse selectOneBuTie(@PathVariable("jibenId")String jibenId ,@PathVariable("zhiwuId")int zhiwuId,@PathVariable("gonghao")String gonghao ){
        List<JibenXinzijisuan> jibenXinzijisuans = jibenButiejisuanService.selectByOnePerson(jibenId, zhiwuId, gonghao);
        return AjaxResponse.success(jibenXinzijisuans);
    }

    @PostMapping("/selectWuXianYijin/{jibenId}")
    public AjaxResponse selectWuXianYijin(@PathVariable("jibenId")String jibenId ){
        List<JibenWuxianyijin> jibenWuxianyijins = jibenWuxianyijinService.selectallWuXianYiJin(jibenId);
        return AjaxResponse.success(jibenWuxianyijins);
    }



}
